package com.ruoyi.project.system.domain.vo;

import com.ruoyi.project.system.domain.Promotion;
import com.ruoyi.project.system.domain.SmProduct;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

@Data
@NoArgsConstructor
public class ProductVo extends Promotion {

    private String scene;

    private BigDecimal basePriceAdd;

    private BigDecimal maxBasePriceAdd;

    private BigDecimal maxPromotionAdd;

    private BigDecimal price;

    public ProductVo(SmProduct smProduct) {
        this.setId(smProduct.getId());
        this.setName(smProduct.getName());
        this.setIntroduce(smProduct.getIntroduce());
        this.scene = smProduct.getScene();
        this.setCode(smProduct.getCode());
        this.setPromotionAdd(smProduct.getPromotionAdd().setScale(2, BigDecimal.ROUND_DOWN));
        this.basePriceAdd = smProduct.getBasePriceAdd().setScale(2, BigDecimal.ROUND_DOWN);
        this.maxPromotionAdd = smProduct.getMaxPromotionAdd().setScale(2, BigDecimal.ROUND_DOWN);
        this.maxBasePriceAdd = smProduct.getMaxBasePriceAdd().setScale(2, BigDecimal.ROUND_DOWN);
    }

}
